package com.aidex.biz.service.impl;

import com.aidex.biz.domain.TempShareRule;
import com.aidex.biz.mapper.TempShareRuleMapper;
import com.aidex.biz.service.TempShareRuleService;
import com.aidex.common.core.service.BaseServiceImpl;
import com.aidex.common.utils.NumberUtils;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 分配规则临时表Service业务层处理
 *
 * @author sean
 * @email 2074844820@qq.com
 * @date 2025-04-03
 */
@Service
@Transactional(readOnly = true)
public class TempShareRuleServiceImpl extends BaseServiceImpl<TempShareRuleMapper, TempShareRule> implements TempShareRuleService {
    private static final Logger log = LoggerFactory.getLogger(TempShareRuleServiceImpl.class);

    /**
     * 获取单条数据
     *
     * @param tempShareRule 分配规则临时表
     * @return 分配规则临时表
     */
    @Override
    public TempShareRule get(TempShareRule tempShareRule) {
        TempShareRule dto = super.get(tempShareRule);
        return dto;
    }

    /**
     * 获取单条数据
     *
     * @param id 分配规则临时表id
     * @return 分配规则临时表
     */
    @Override
    public TempShareRule get(String id) {
        TempShareRule dto = super.get(id);
        return dto;
    }


    /**
     * 查询分配规则临时表列表
     *
     * @param tempShareRule 分配规则临时表
     * @return 分配规则临时表
     */
    @Override
    public List<TempShareRule> findList(TempShareRule tempShareRule) {
        return super.findList(tempShareRule);
    }

    /**
     * 分页查询分配规则临时表列表
     *
     * @param tempShareRule 分配规则临时表
     * @return 分配规则临时表
     */
    @Override
    public PageInfo<TempShareRule> findPage(TempShareRule tempShareRule) {
        return super.findPage(tempShareRule);
    }

    /**
     * 保存分配规则临时表
     *
     * @param tempShareRule
     * @return 结果
     */
    @Override
    @Transactional(readOnly = false)
    public boolean save(TempShareRule tempShareRule) {
        return super.save(tempShareRule);
    }


    /**
     * 删除分配规则临时表信息
     *
     * @param tempShareRule
     * @return 结果
     */
    @Override
    public boolean remove(TempShareRule tempShareRule) {
        return super.remove(tempShareRule);
    }

    /**
     * 批量删除分配规则临时表
     *
     * @param ids 需要删除的分配规则临时表ID
     * @return 结果
     */
    @Transactional(readOnly = false)
    @Override
    public int deleteTempShareRuleByIds(String[] ids) {
        return mapper.deleteTempShareRuleByIds(ids);
    }

    /**
     * 获取最大编号
     *
     * @param tempShareRule 分配规则临时表
     * @return 结果
     */
    @Override
    public int findMaxSort(TempShareRule tempShareRule) {
        return NumberUtils.nextOrder(mapper.findMaxSort(tempShareRule));
    }

    /**
     * 根据规则主键id删除规则临时表
     *
     * @param ids
     * @return
     */
    @Transactional(readOnly = false)
    @Override
    public int deleteTempShareRuleByRuleIds(String[] ids) {
        return mapper.deleteTempShareRuleByRuleIds(ids);
    }

    @Transactional(readOnly = false)
    @Override
    public int deleteTempShareRuleByRuleIdLaiyuan(TempShareRule tempShareRule){
        return mapper.deleteTempShareRuleByRuleIdLaiyuan(tempShareRule);
    }
}
